package com.jeff.vo;

import com.jeff.common.mConst;
import com.jeff.po.BasePo;
import com.jeff.po.Form;
import com.jeff.po.FormTh;

import java.io.Serializable;
import java.util.List;
import java.util.UUID;

/**
 * 表单输入
 * Created by King-z on 2019/2/9 0009.
 */
public class FormInsertVo extends BasePo implements Serializable {
    private String name;//表单名称
    private String deptId;//所属社团

    private List<FormTh> elements;//报名内容

    private Form form;

    public FormInsertVo() {
        super();
    }


    public List<FormTh> getElements() {
        for (FormTh item : elements) {
            item.setFormId(form.getId());
        }
        return elements;
    }

    public void setElements(List<FormTh> elements) {
        this.elements = elements;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public Form getForm() {
        form = new Form();
        form.setId(UUID.randomUUID().toString());
        form.setName(this.getName());
        form.setDeptId(this.getDeptId());
        form.setState(mConst.STATE_T);
        return form;
    }

    public List<FormTh> getFormth() {
        return getElements();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}